<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <title>无标题页</title>
<link rel="stylesheet" type="text/css" href="../css/index.css">
<script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
<script>
var a=0;
//生成用户户号
function us(){
	if(a==0){
	var myDate = new Date();	
    var id = Math.ceil(Math.random()*10);
	var usenum=myDate.getYear()+""+myDate.getMonth()+""+myDate.getDate()+""+myDate.getHours()+""+myDate.getMinutes()+""+id;
	document.getElementById("usernum").value=usenum;
	}
	a++;
}
//进行开户操作
function openAccount(){
		//$("#queding").attr("disabled","disabled");
		 //账号
		var username=document.getElementById("useraccount").value.trim();
		//用户户号
		var usernum=document.getElementById("usernum").value.trim();
		 //密码
		var userpwd=document.getElementById("userpwd").value.trim();
		var userpwd1=document.getElementById("userpwd1").value.trim();
		//姓名
		var name=document.getElementById("usname").value.trim();
		//出生日期
		var birthday=document.getElementById("birth1").value+"-"+document.getElementById("birth2").value+"-"+document.getElementById("birth3").value;
		var birth=birthday.trim();
		//性别
		var sex=document.getElementsByName("sex");
		for(var i=0;i<sex.length;i++){
			if(sex[i].checked){
				sex=sex[i].value;
			if(sex=="male"){
				sex="男";
			}else{
				sex="女";
			}
			}
		}
		//地址
		var adress=document.getElementById("adress").value.trim();
		//号码
		var telephone=document.getElementById("telephone").value.trim();
		//身份证号
		var carid=document.getElementById("carnum").value.trim();
		//开户金额
		var openmoney=document.getElementById("openmoney").value.trim(); 
		var js=new Object();
		js.user_name=username;
		js.user_num=usernum;
		js.user_pwd=userpwd;
		js.name=name;
		js.birthday=birth;
		js.sex=sex;
		js.adress=adress;
		js.telephone=telephone;
		js.id_card=carid;
		js.openmoney=openmoney; 
		var js_data = JSON.stringify(js); 
		var reg = /^(\d{4})-(\d{2})-(\d{2})$/; 
		if(userpwd==userpwd1&&userpwd!=""){ 
			if(name!=""){
				if(reg.test(birth)&&RegExp.$2<=12&&RegExp.$3<=31){
					if(adress!=""){
						if(telephone!=""){
							if(carid!=""){
								if(openmoney!=""){
			$.ajax({	
				url:"openAccout/openAcc",
				type:"post",
				data:{jso:js_data},
				//这是请求成功后回调的函数
				success:function(data){
					depositMoney(openmoney,usernum);
				}
			});
		}else{
			alert("请输入开户金额");
		}
		}else{
			alert("请输入身份证号");
		}
		}else{
			alert("请输入联系电话");
		}
		}else{
			alert("请输入住址");
		}
		}else{
			alert("请确定是否输入出生日期或确定其格式是否正确");
		}
		}else{
			alert("请输入姓名");
		}
		}else{
			alert("密码输入错误"); 
		}  
} 
//判断密码
function pw(){
var userpwd=document.getElementById("userpwd").value;
var userpwd1=document.getElementById("userpwd1").value;
	if(userpwd == userpwd1) {
                  document.getElementById("tishi").innerHTML="<font color='green'>密码相同</font>";
                  //document.getElementById("submit").disabled = false;
                  $("#tishi").show().delay(3000).hide(0);
              }
              else {
                  document.getElementById("tishi").innerHTML="<font color='red' >密码不同,请重新输入！</font>";
                //document.getElementById("submit").disabled = true;
                $("#tishi").show().delay(3000).hide(0);
              }
}
//判断账户
function useron(){
	var username=document.getElementById("useraccount").value;
	if(username.trim()!=""){
	$.ajax({	
		url:"openAccout/openSelc",
		data:{usename:username},
		//这是请求成功后回调的函数
		success:function(data){
		 document.getElementById("zhanghu").innerHTML="<font color='red' >"+data+"</font>";
		 $("#zhanghu").show().delay(3000).hide(0);	
		}
		});
		}else{
		document.getElementById("zhanghu").innerHTML="<font color='red' >请输入账户</font>";
		$("#zhanghu").show().delay(3000).hide(0);
		}
		$("queding").attr('disabled',true);
	}

	//将首次开户金额存入
function depositMoney(openmoney,usernum){
	$.ajax({	
		url:"openAccout/openDeposit",
		data:{openMoney:openmoney,usernum:usernum},
		//这是请求成功后回调的函数
		success:function(data){
		document.getElementById("jieguo").innerHTML="<font color='red'>"+data+"</font>";
		$("#jieguo").show().delay(3000).hide(0);
		alert(data);
			history.go(0);
		}
		});
		//setTimeout(refesh(),"5000");
}	

function refesh(){
	history.go(0);
}
function startTime()     
          {     
              var today=new Date();//定义日期对象     
              var yyyy = today.getFullYear();//通过日期对象的getFullYear()方法返回年      
              var MM = today.getMonth()+1;//通过日期对象的getMonth()方法返回年      
              var dd = today.getDate();//通过日期对象的getDate()方法返回年       
              var hh=today.getHours();//通过日期对象的getHours方法返回小时     
              var mm=today.getMinutes();//通过日期对象的getMinutes方法返回分钟     
              var ss=today.getSeconds();//通过日期对象的getSeconds方法返回秒     
              // 如果分钟或小时的值小于10，则在其值前加0，比如如果时间是下午3点20分9秒的话，则显示15：20：09     
              MM=checkTime(MM);  
              dd=checkTime(dd);  
              mm=checkTime(mm);     
              ss=checkTime(ss);      
              document.getElementById('nowDateTimeSpan').innerHTML=yyyy+"-"+MM +"-"+ dd +" " + hh+":"+mm+":"+ss;
                setTimeout('startTime()',1000);//每一秒中重新加载startTime()方法   
            }     
              
            function checkTime(i)     
            {     
                if (i<10){  
                    i="0" + i;  
                }     
                  return i;  
            }    

</script>




</head>
<body class="mian_bj" onload="startTime()">
<div class="mian_top_01">
<div class="mian_top_r"></div>
<div class="mian_top_l"></div>
<div class="mian_top_c">
<ul>
	<!-- <li>
		<a href="openAccout/enableSelectCon?currentPage=1">
		<p>
		启用账户</p>
		</a></li>
		<li><a href="openAccout/frozeSelectCon?currentPage=1">
		<p>
		冻结账户</p>
		</a></li> -->
		<li><a href="openAccount.jsp">
		<p>
		开户</p>
</a></li>

</ul>
</div>
<div class="mian_b">
<table width="100%" border="1" cellpadding="0" cellspacing="0" class="mian_b_bg_xz">
<tr>
<td width="5%" class="mian_b_bg_lm">&nbsp;</td>
<td colspan="3" class="mian_b_bg_lm">开户界面</td>
</tr>
<tr>
<td>&nbsp;</td>
<td width="15%" valign="top">用户账户</td>
<td width="60%">
<input type="text" class="input_01" name="textfield" id="useraccount" onkeyup="us()" onblur="useron()"><span id="zhanghu"></span> </td>
<td width="20%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td width="15%" valign="top">用户户号</td>
<td width="60%">
<input type="text" class="input_01" name="textfield" id="usernum" readonly="readonly" style="background:#CCCCCC" value=""> </td>
<td width="20%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top">用户密码</td>
<td><input type="text" class="input_01" name="textfield" id="userpwd">
 </td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top">确认密码</td>
<td><input type="text" class="input_01" name="textfield" id="userpwd1" onkeyup="pw()"><span id="tishi"></span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">用户信息  详情<span style="color:red">(红色为必填)</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top" style="color:red">用户姓名</td>
<td><input type="text" class="input_01" name="textfield" id="usname"></td>
<td>&nbsp;</td>
</tr>

<td>&nbsp;</td>
<td valign="top" style="color:red">性别</td>
<td>
<input type="radio" name="sex" value="male" checked="checked"/> 男
<input type="radio" name="sex" value="female" /> 女
 </td>
<td>&nbsp;</td>
</tr>

<tr>
<td></td>
<td colspan="3">
<table width="100%" border="1" style="border-top:1px solid #fff; border-bottom:1px solid #fff;" cellpadding="0" cellspacing="0" class="mian_b_bg_xz">
<tr>
<td align="center">籍贯：</td><td align="center" style="color:red">证件种类：</td><td align="center" style="color:red">证件号码：</td>
</tr>
<tr>
<td align="center"><input type="text" class="input_01" name="textfield" id="text7"></td>
<td align="center"><input type="text" class="input_01" name="textfield" id="text7"></td>
<td align="center"><input type="text" class="input_01" name="textfield" id="carnum" ></td>
<td></td>
</tr>
</table>
</td>
</tr>

<tr>
<td>&nbsp;</td>
<td colspan="3">
<table width="100%" border="1" style="border-top:1px solid #fff; border-bottom:1px solid #fff;" cellpadding="0" cellspacing="0" class="mian_b_bg_xz">
<tr>
<td align="center" style="color:red">联系方式</td><td align="center" style="color:red">居住住址</td><td align="center">邮编</td>
</tr>
<tr>
<td align="center"><input type="text" class="input_01" name="textfield" id="telephone"></td>
<td align="center"><input type="text" class="input_01" name="textfield" id="adress"></td>
<td align="center"><input type="text" class="input_01" name="textfield" id="text7"></td>
<td></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3">
<table width="100%" border="1" style="border-top:1px solid #fff; border-bottom:1px solid #fff;" cellpadding="0" cellspacing="0" class="mian_b_bg_xz">
<tr>
<td align="center" style="color:red">出生日期</td><td align="center">是否结婚</td><td align="center">月收入</td>
</tr>
<tr>
<td align="center"><input type="text" class="input_04" name="textfield" id="birth1"> 年<input type="text" class="input_04" name="textfield" id="birth2">月<input type="text" class="input_04" name="textfield" id="birth3">日</td>
<td align="center"><input type="radio" name="liberary" value="yes" /> 是
<input type="radio" name="liberary" value="no"/> 否</td>
<td align="center"><select>
			<option>5000以下</option>
			<option>5000-8000</option>
			<option>8000-12000</option>
			<option>12000以上</option>
		</select></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top" style="color:red">开户金额</td>
<td><input type="text" class="input_01" name="textfield" id="openmoney"> 元(人民币)</td>
<td>&nbsp;</td>
</tr>


<tr>
<td>&nbsp;</td>
<td valign="top">备注</td>
<td><input type="text" class="input_01" name="textfield" id="text7">
</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top">上传客户资料附件</td>
<td><input id="File2" type="file">
</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top" style="color:red">开户人员确认</td>
<td><input type="text" class="input_01" name="textfield" id="text42">
</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top" style="color:red">工作人员确认</td>
<td><input type="text" class="input_01" name="textfield" id="text43">
</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top">日期</td>
<td><span id="nowDateTimeSpan"></span> 

</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>
<div align="center">
<input type="image" src="..\images\bnt_03.gif"  onclick="openAccount();" id="queding" />
<input type="image" src="..\images\bnt_05.gif"  onclick="javascript:history.go(0)"><span id="jieguo"></span></div></td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</div>
</body>
</html>
<!-- <script src="/common.js"></script> -->
